package com.jingdianjichi;

public class PageResponse<A extends PageReqyest> {
    private  Integer pageNo =1;
    private  Integer pageSize =10;
    private  Integer total =0;
    private  Integer totalPages =0;
    //private List<T> result = Collections.emptyList();
    private  Integer start =1;
    private  Integer end=0;


    public PageResponse(){
    }


    public void setCurrent(Integer pageNo){
        if(pageNo!=null&&pageNo>0){
            this.pageNo=pageNo;
        }
    }


    public void setPageSize(Integer pageSize){
        if(pageSize!=null&&pageSize>0){
            this.pageSize=pageSize;
        }
    }




    public void setTotal(Integer total){
        this.total=total;
        if(total==-1)
        {
         this.pageNo=1;
         return;
        }
        if(this.pageSize>0){
            this.totalPages=(total/this.pageSize)+(total%this.pageSize==0?0:1);
        }
        else {
            this.totalPages=0;
        }
        //this.start=(this.pageNo>0?(this.pageNo-1)*this)
    }


}
